//
//  UIView+Lookfor.m
//
//  Created by zhaol on 9/18/15.
//  Copyright (c) 2015 zify. All rights reserved.
//

#import "UIView+Lookfor.h"

@implementation UIView(Lookfor)

- (void)lookforView:(Class)viewClass withBlock:(void (^)(UIView *, BOOL *))handleBlock
{
    BOOL stop = NO;
    for (UIView *view in self.subviews) {
        if ([view isKindOfClass:viewClass]) {
            handleBlock(view, &stop);
            if (stop) {
                return;
            }
        }
        [view lookforView:viewClass withBlock:handleBlock];
    }
}

@end
